package com.laboratory.equal;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Sample {

	/**
	 * @param args  
	 */
	public static void main(String[] args) {
		String str1 = new String("str");
        String str2 = new String("str");
        //==：全等
        System.out.println("==比较 ："+ (str1 == str2));
        System.out.println("equal比较："+ str1.equals(str2));
        String str3 = "str1";
        String str4 = "str1";
        System.out.println("==比较 ："+ (str3 == str4));
        System.out.println("equal比较："+ str3.equals(str4));

        Map ma1 = new HashMap();
        ma1.put("a", "2");
        Map ma2 = new HashMap();
        ma2.put("a", "1");

        boolean equals = ma1.equals(ma2);

        System.out.println("equals = " + equals);

        List arrayList = new ArrayList();
        arrayList.add(ma1);
        arrayList.add(ma2);

        boolean equals1 = arrayList.get(0).equals(arrayList.get(1));

        System.out.println("equals1 = " + equals1);

    }

}
